#ifndef  _SOCKET_H_
#define  _SOCKET_H_

#define HOSTNAME_LEN          64

typedef struct socket_s
{
	int				fd;
	char			host[64]; /* socket server host name or IP address */
	int				port; /* socket server listen port */
} socket_t;

/* Description: Initial socket work context structure. */
int socket_init(socket_t *sock, char *hostname, int port);

/* Description: Connect to socket server if not connected */
int socket_connect(socket_t *sock);

/* Description: Check and set socket connect status */
int check_connect(int sockfd);

/* Description: Close the socket */
int socket_close(socket_t *sock);

#endif   /* ----- #ifndef _SOCKET_H_  ----- */
